package com.yang.biz.modular.dynamictablename.aop;

import com.yang.common.util.CommonServletUtil;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: yangjianzhi
 * @version1.0
 */
@Aspect
@Component
public class DynamicTableNameRequestDataAop {

    @Before("execution(* com.yang.biz.modular.dynamictablename.controller.UsyController.*(..))")
    public void beforeControllerMethodExecution() {
        try {
            String name = CommonServletUtil.getParamFromRequest("name");
            String date = CommonServletUtil.getParamFromRequest("date");
            Map<String, Object> map = new HashMap<>();
            map.put("name", name);
            map.put("date", date);
            RequestDataHelper.setRequestData(map);
        } catch (Exception ignored) {
        }
    }
}
